package com.gok.seasonmovie.mapper;

import com.gok.seasonmovie.entity.Seat;
import io.micrometer.core.instrument.distribution.StepBucketHistogram;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface SeatMapper {

    @Select("SELECT * FROM seat WHERE cid = #{cid} AND mid = #{mid} AND starttime= #{starttime}")
    List<Seat> getSeat(@Param("cid") String cid, @Param("mid") String mid, @Param("starttime") String starttime);

    @Insert({"INSERT INTO seat (",
            "cid , mid , starttime , seat",
            ") VALUES (",
            "#{cid}, #{mid},#{starttime},#{seats}",
            ")"
    })
    void insertSeats(@Param("cid") String cid, @Param("mid") String mid, @Param("starttime") String starttime, @Param("seats") Integer seats);
}
